package com.bkgrands.fpmu.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.bkgrands.fpmu.Adapters.SiteAdapter;
import com.bkgrands.fpmu.R;
import com.bkgrands.fpmu.classes.StaticFarm;

public class SItesActivity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private SiteAdapter adapter;
    static String numofprojects;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_pending );
        initViews();
    }
    private void initViews(){
        recyclerView = (RecyclerView)findViewById(R.id.item_recycler_view);
        recyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
        recyclerView.setLayoutManager(layoutManager);
        loadJSON();
    }

    private void loadJSON(){
        adapter = new SiteAdapter(getApplicationContext(),StaticFarm.responseAtLogin.getPayload());
        numofprojects=String.valueOf(adapter.getItemCount());
        StaticFarm.siteAdapter = adapter;
        recyclerView.setAdapter(adapter);
    }

}
